#include <iostream>
#include <vector>
#include <algorithm>

int dp_method(std::vector<int> &v, int m)
{
    int max_tm = *std::max_element(v.begin(), v.end());

    std::vector<int> dp(max_tm + 1, 0);
    for (int i = 0; i < v.size(); i++)
    {
        for (int j = v[i]; j >= m; j--)
        {
            bool find = false;
            for (int k = 0; k < v.size(); k++)
            {
                if (j == v[k])
                {
                    find = true;
                    break;
                }
            }
            if (find)
                dp[j] = std::max(dp[j], dp[j - m] + 1);
        }
    }

    return dp[max_tm];
}

int greedy_method(std::vector<int> &v, int m)
{
    int curr = -m - 1;
    int cnt = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] - curr >= m)
        {
            curr = v[i];
            cnt++;
        }
    }

    return cnt;
}

int main()
{
    int n, m;
    std::cin >> n >> m;

    std::vector<int> v;
    for (int i = 0; i < n; i++)
    {
        int x, y;
        std::cin >> x >> y;
        v.push_back(x + y);
    }
    int maxv = greedy_method(v, m);
    std::cout << maxv << std::endl;
    return 0;
}